package com.blog.controller.user;

import com.blog.constant.Constant;
import com.blog.pojo.User;
import com.blog.response.ResponseResult;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description User的接口API
 * @Author XiaoLin
 * @Date 2021/2/25 22:11
 */
@Slf4j
@RestController
@RequestMapping("/user")
public class UserController {
  
  /**
      * @Description:用于初始化管理员账号
      * @author XiaoLin
      * @date 2021/2/25
      * @Param: [user]
      * @return com.blog.response.ResponseResult
      */
  @ApiOperation(value = "初始化管理员账号")
  @PostMapping("/admin_account")
  public ResponseResult initManagerAccount(@RequestBody User user){
    log.info(user.getUserName());
    return ResponseResult.SUCCESS();

  }

  /**
      * @Description:用户注册
      * @author XiaoLin
      * @date 2021/2/25
      * @Param: [user]
      * @return com.blog.response.ResponseResult
      */
  @PostMapping
  public ResponseResult register(@RequestBody User user){
    return null;
  }

  /**
      * @Description:用户登录
      * @author XiaoLin
      * @date 2021/2/25
      * @Param: [captche, user]
      * @return com.blog.response.ResponseResult
      */
  @PostMapping("/{captcha}")
  public ResponseResult login(@PathVariable("captcha") String captche,@RequestBody User user){
    return null;
  }

  /**
      * @Description:获取验证码
      * @author XiaoLin
      * @date 2021/2/25
      * @Param: []
      * @return com.blog.response.ResponseResult
      */
  @GetMapping("/captcha")
  public ResponseResult getCaptcha(){
    return null;
  }

  /**
      * @Description:发送邮箱验证码
      * @author XiaoLin
      * @date 2021/2/25
      * @Param: [emailAddress]
      * @return com.blog.response.ResponseResult
      */
  @GetMapping("/verify_code")
  public ResponseResult sendVerifyCode(@RequestParam("email") String emailAddress){
    return null;
  }

  /**
      * @Description:用户修改密码
      * @author XiaoLin
      * @date 2021/2/25
      * @Param: [user]
      * @return com.blog.response@PutMapping("/{id}").ResponseResult
      */
  @PutMapping("/password/{id}")
  public ResponseResult updatePassword(@PathVariable("id") String id, @RequestParam User user){
    return null;
  }

  /**
      * @Description:获取用户信息
      * @author XiaoLin
      * @date 2021/2/25
      * @Param: [id]
      * @return com.blog.response.ResponseResult
      */
  @GetMapping("/{id}")
  public ResponseResult getUserInfo(@PathVariable("id") String id){
    return null;
  }

  /**
      * @Description:修改用户信息
      * @author XiaoLin
      * @date 2021/2/25
      * @Param: [user]
      * @return com.blog.response.ResponseResult
      */
  @PutMapping("/{id}")
  public ResponseResult updateUserInfo(@PathVariable("id") String id,@RequestBody User user){
    return null;
  }

  /**
      * @Description:查询所有用户
      * @author XiaoLin
      * @date 2021/2/26
      * @Param: [currentPage, pageSize]
      * @return com.blog.response.ResponseResult
      */
  @GetMapping("/list")
  public ResponseResult listUsers(@RequestParam("currentPage") Integer currentPage,@RequestParam("pageSize") Integer pageSize){
    return null;
  }

  /**
      * @Description:根据id删除用户
      * @author XiaoLin
      * @date 2021/2/26
      * @Param: [id]
      * @return com.blog.response.ResponseResult
      */
  @DeleteMapping("/{id}")
  public ResponseResult deleteUser(@PathVariable("id") String id){
    return null;
  }
}
